package design.mode.decorator;

/**
 * @author ZhongMingde on 2021/11/4
 */

public class BufferedInputStream extends InputStream{

  protected volatile InputStream in;

  public BufferedInputStream() {
  }

  public BufferedInputStream(InputStream in) {
    this.in = in;
  }

  @Override
  public int read(byte[] b) {
    return read(b,0,b.length);
  }

  @Override
  public int read(byte[] b, int off, int len) {
    System.out.println(in.read(b));
    return 2;
  }
}
